//
//  RMMMineMyWalletView.m
//  Romomo
//
//  Created by puman on 2016/12/28.
//  Copyright © 2016年 mazegong. All rights reserved.
//

#import "RMMMineMyWalletView.h"

@implementation RMMMineMyWalletView
{
    UIImageView *_iamgeV;
    UILabel *_label;
    UIProgressView *_progressView;
    UILabel *_contentLabel;
    UILabel *_labelB;
}
- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = kBasicColor;
        
        _iamgeV = [[UIImageView alloc] initWithFrame:CGRectMake((self.width - 78) / 2, 30, 78, 78)];
        _iamgeV.layer.masksToBounds = YES;
        _iamgeV.layer.cornerRadius = 39;
        _iamgeV.layer.borderColor = kWhiteColor.CGColor;
        _iamgeV.layer.borderWidth = 3;
        [self addSubview:_iamgeV];
        
        _label = [[UILabel alloc] initWithFrame:CGRectMake(0, _iamgeV.bottom + kRow, self.width, kMaric)];
        _label.font = kFont(16);
        _label.textAlignment = NSTextAlignmentCenter;
        _label.textColor = COLORFROMCODE(0x2C2C2C, 1);
        [self addSubview:_label];
        
        for (int i = 0; i < 2; i++) {
            UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(((self.width - 214) / 2.0 + 214) * i , _label.bottom + kRow, (self.width - 214) / 2.0, kMaric)];
            label.textColor = COLORFROMCODE(0x318079, 1);
            label.font = kFont(10);
            if (i == 0) {
                label.textAlignment = NSTextAlignmentRight;
                label.text = @"一般颜值";
                _progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(label.right + 7, label.top + 7.5, 200, 5)];
                _progressView.progressTintColor = COLORFROMCODE(0x318079, 1);
                _progressView.trackTintColor = kWhiteColor;
                [self addSubview:_progressView];
            } else {
                _labelB = label;
                _contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, label.bottom + kRow, self.width, 40)];
                _contentLabel.textColor = kWhiteColor;
                _contentLabel.font = kFont(13);
                _contentLabel.textAlignment = NSTextAlignmentCenter;
                _contentLabel.numberOfLines = 0;
                [self addSubview:_contentLabel];
            }
            [self addSubview:label];
        }
        _iamgeV.image = [UIImage imageNamed:@"Icon-iPhone-60@3x"];
        _label.text = @"容么么";
        
    }
    return self;
}
- (void)setDic:(NSDictionary *)dic{
    [_iamgeV sd_setImageWithURL:[NSURL URLWithString:[RMMFileManager retrunObjWith:[NSString stringWithFormat:@"%@%@",kBaseImageUrl,dic[@"IMAGE_URL"]]]] placeholderImage:[UIImage imageNamed:@"Icon-iPhone-60@3x"]];
}
- (void)setDataDic:(NSDictionary *)dataDic{
    _label.text = [NSString stringWithFormat:@"%@",dataDic[@"CUST_NAME"]];
    [_iamgeV sd_setImageWithURL:[NSURL URLWithString:[RMMFileManager retrunObjWith:[NSString stringWithFormat:@"%@%@",kBaseUrl,dataDic[@"IMAGE_URL"]]]] placeholderImage:[UIImage imageNamed:@"Icon-iPhone-60@3x"]];
    CGFloat score = [dataDic[@"ALL_POINTS"] floatValue];
    _progressView.progress = score / 10000.00;
    if (score < 10000) {
        CGFloat s = 10000.00 - [dataDic[@"ALL_POINTS"] floatValue];
        _contentLabel.text = [NSString stringWithFormat:@"本月获得颜值%@分,累计获得颜值%@分,再获得%.0f分即可颜值爆表",dataDic[@"MONTH_POINTS"],dataDic[@"ALL_POINTS"],s];
        _labelB.text = @"高颜值";
    } else {
        _contentLabel.text = [NSString stringWithFormat:@"本月获得颜值%@分,累计获得颜值%@分",dataDic[@"MONTH_POINTS"],dataDic[@"ALL_POINTS"]];
        _labelB.text = @"颜值爆表";
    }

}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
